<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <!-- ，输入一个整数，判断大于0小于0还是等于0 -->
 输入一个数：
    <input  id="num" type="text"><br/>
    <input type="button" value="判断数字" onclick="fn()" />
    结果：<input id="result" type="text" /><br />
    <script>
        function fn() {
            var num = document.getElementById("num").value;
            var result = "";
            if (num > 0) {
                result = "大于0"
            }
            else if (num < 0) {
                result = "小于0"
            }
            else{
                result = "等于0"
            }
            document.getElementById("result").value = result;
        }
    </script> 
    <!-- <script>
        function getNumber(num){
            if(num=0){
                return 等于0;
            }
            else{
                if(num>0){
                    return 大于0;
                }
              return -1;
            }
        }
        getNumber(5)
    </script> -->
</body>

</html>
